package com.xueyi.aixihu.reqeust;

import com.xueyi.aixihu.exception.SzException;
import com.xueyi.aixihu.reqeust.base.PageLimitReq;
import com.xueyi.aixihu.status.SystemCode;
import lombok.Data;
import org.springframework.util.StringUtils;

/**
 * 描述 报表集合Req
 *
 * @auther 俞烨
 * @date 2022-08-17 11
 */
@Data
public class FinanceReq extends PageLimitReq {


    /**
     * 网页条件
     */
    private String financeTitle;
    private Integer oneType;
    private String twoType;
    private String month;


    private boolean isYear;

    private Integer financeType;

    private Integer areaType;

    private Integer isPublic;

    private Integer fb;
    private Integer fb2;

    public void format() {

        twoType = StringUtils.hasLength(twoType) ? twoType : null;
        financeTitle = StringUtils.isEmpty(financeTitle) ? null : financeTitle;
        if (StringUtils.isEmpty(month)) {
            month = null;
        } else {
            isYear = month.length() == 4;
        }
        countStartIndex();
    }


    public void formatNew() throws SzException {
        format();
    }
}